
{extend name='public/window' /}


{block name="content"}




    <div class="layui-fluid">
        <div class="layui-card">
            <!-- <div class="layui-card-header"></div>-->

            <div class="layui-card-body" style="padding: 15px;">
                <form class="layui-form" action="" lay-filter="component-form-group">

                    <div class="layui-form-item">
                        <label class="layui-form-label">上级菜单</label>
                        <div class="layui-input-block">

                            <select name="pid" lay-search="">
                                <option value="0" {eq name="$pid" value="0"} selected {/eq}>顶级菜单</option>
                                {volist name="tree" id="t"}
                                <option value="{$t.id}" {eq name="$pid" value="$t.id"} selected {/eq}>{$t.title_show}</option>
                                {/volist}
                            </select>

                        </div>
                    </div>

                    <input type="hidden" name="id" value="{$info.id}">

                    <input type="hidden" name="fontFamily" value="fa">

                    {:token()}


                    <div class="layui-form-item">
                        <label class="layui-form-label label-required-next">菜单名称：</label>
                        <div class="layui-input-block input-custom-width" style="">
                            <input type="text" name="title"  lay-verify="required" lay-vertype="tips" lay-reqtext="请输入菜单名称" autocomplete="off" class="layui-input " placeholder="请输入菜单名称" value="{$info.title}">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label  class="layui-form-label">菜单图标：</label>
                        <div class="layui-input-block">
                            <input type="text" id="iconPicker" value="{$info.icon}" name="icon" lay-filter="iconPicker" class="hide">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label label-required-next">是否菜单：</label>
                        <div class="layui-input-block input-custom-width">
                            <input type="radio" name="is_menu" value="1" title="菜单"   checked>
                            <input type="radio" name="is_menu" value="2" title="按钮" >
                        </div>
                        <div class="layui-form-mid layui-word-aux"></div>
                    </div>


                    <div class="layui-form-item">
                        <label class="layui-form-label">地址：</label>
                        <div class="layui-input-block input-custom-width" style="">
                            <input type="text" name="href" value="{$info.href}" placeholder="请求地址" lay-verify="" lay-vertype="tips" lay-reqtext="请求地址" autocomplete="off" class="layui-input ">
                            <p class="help-block">格式例如：index/index/index（模块名/控制器名/方法名）</p>
                        </div>
                    </div>



                    <div class="layui-form-item">
                        <label class="layui-form-label label-required-next">是否显示：</label>
                        <div class="layui-input-inline input-custom-width">
                            <input type="radio" name="status" value="1" title="显示"  checked>
                            <input type="radio" name="status" value="2" title="隐藏"  >
                        </div>
                        <div class="layui-form-mid layui-word-aux"></div>

                        <label class="layui-form-label label-required-next">菜单排序：</label>
                        <div class="layui-input-inline input-custom-width">
                            <input type="number" name="listorder"  value="{$info.listorder}"   placeholder="排序" lay-verify="" lay-verType="tips" lay-reqText="排序"  autocomplete="off"  class="layui-input">
                            <p class="help-block">数字越大越靠前</p>
                        </div>
                    </div>


                    {:widget('common/forms/submit',array('add','立即提交',2))}


                </form>
            </div>
        </div>
    </div>




<script>
    layui.use(['element', 'form', 'jquery','iconPickerFa','lucky'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var iconPickerFa = layui.iconPickerFa;
        var lucky = layui.lucky;

        iconPickerFa.render({
            // 选择器，推荐使用input
            elem: '#iconPicker',
            // fa 图标接口
            url: "__PLUGS__/font-awesome/less/variables.less",
            // 是否开启搜索：true/false，默认true
            search: true,
            // 是否开启分页：true/false，默认true
            page: true,
            // 每页显示数量，默认12
            limit: 12,
            // 点击回调
            click: function (data) {
                console.log(data);
            },
            // 渲染成功后的回调
            success: function (d) {
                console.log(d);
            }
        });


        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('addMenu')}",data.field,"table_id",1);
            return false;
        });
    })
</script>


{/block}